<?php
session_start();
include('../include/dbFunctions.php');

//Innitialization of variable
$table = 'school';

//Retrieve data from POST
$school_name = ($_POST['school_name']);
$school_address = ($_POST['school_address']);
$school_description = ($_POST['school_description']);
$education_id = ($_POST['education_id']);
$location_id = ($_POST['location_id']);
$school_postal = ($_POST['school_postal']);
$last_modified = date("Y-m-d H:i:s");
$school_status='active';
//Add data to database
$sQuery ='INSERT INTO school(school_name,school_description,school_address,school_status,school_postal,created_date,last_modified,location_id,education_id)
VALUES ("'.$school_name.'","'.$school_description.'","'.$school_address.'","'.$school_status.'","'.$school_postal.'","'.$last_modified.'","'.$last_modified.'","'.$location_id.'","'.$education_id.'")';
    $sResult=executeQuery($sQuery);
    if($sResult!=0){
        $_SESSION['mes']="New school has been added sucessfully.";
    }else{
        $_SESSION['mes']="Error! Please try again.";
    }header('Location: schoolManage.php');

?>
